package com.ruoyi.web.controller.system;

import com.ruoyi.system.domain.PushRequest;
import com.ruoyi.system.service.GeTuiPushService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/push")
public class GeTuiController {
    @Autowired
    private GeTuiPushService geTuiPushService;

    @PostMapping("/send")
    public String push(@RequestBody PushRequest request) {
        if (request.getCid() == null || request.getCid().isEmpty()) {
            return "cid 参数缺失";
        }

        // 调用个推推送服务
        geTuiPushService.pushToSingle(request.getCid(), request.getTitle(), request.getBody(), request.getUrl());
        return "推送已发送！";
    }
}
